package com.menghao.sso.client.http;

import com.menghao.sso.client.model.ClientUser;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletRequestWrapper;

/**
 * <p>Todo.<br>
 *
 * @author menghao.
 * @version 2017/11/2.
 */
public class SsoRequestWrapper extends HttpServletRequestWrapper {

    private ClientUser clientUser;

    public SsoRequestWrapper(HttpServletRequest request) {
        super(request);
    }

    public SsoRequestWrapper(HttpServletRequest request, ClientUser clientUser) {
        this(request);
        this.clientUser = clientUser;
    }

    @Override
    public String getRemoteUser() {
        return clientUser.getUsername();
    }

    @Override
    public String getAuthType() {
        return clientUser.getRole();
    }
}
